package videoExercises;

import java.util.Objects;

public class Studengt1 {
    private String name;
    private int age;
    public Studengt1(){}
    public Studengt1(String name,int age){
        this.name=name;
        this.age=age;
    }
    public void setName(String name){
        this.name=name;
    }
    public String getName(){
        return name;
    }
    public void setAge(int age){
        this.age=age;
    }
    public int getAge(){
        return age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Studengt1 studengt1 = (Studengt1) o;
        return age == studengt1.age && Objects.equals(name, studengt1.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }
    public String toString(){
        return "Studengt1{" + "姓名='" + name + '\'' + ", 年龄=" + age + '}';
    }
}
